package user

import (
	"github.com/gin-gonic/gin"
	"smartLearn/models"
	"smartLearn/modules/response"
	"strconv"
)

func UpdateLibrary(c *gin.Context) {

	inlibrary, err := strconv.Atoi(c.Query("inlibrary"))
	if err != nil {
		response.ShowError(c, err.Error())
		return
	}

	userId, err := strconv.Atoi(c.Query("userId"))
	if err != nil {
		response.ShowError(c, err.Error())
		return
	}
	ids:= c.Query("ids")




	userLibraryModel:=models.UserLibrary{}
	userLibraryModel.UserId=userId

	err=userLibraryModel.UpdateInLibrary(ids,inlibrary)
	if err != nil {
		response.ShowError(c, err.Error())
		return
	}
	response.ShowSuccess(c,"更新入库状态成功")
}
